<script>
export default {
  name: "abc",
  data() {
    return {
      loginForm: {
        username: "admin",
        password: "admin123",
      },
    };
  },
  methods: {
    denglu() {
      console.log(this.loginForm);
      this.$store.dispatch("Login", this.loginForm).then(() => {
        this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
      }).catch(() => {
        console.error("error");
      });
    },
  }
}

</script>

<template>
  <div class="login">
    <el-form class="login-form">
      <el-form-item label="账号">
        <el-input v-model="loginForm.username" placeholder="请输入内容" type="text"></el-input>
      </el-form-item>

      <el-form-item label="密码">
        <el-input v-model="loginForm.password" placeholder="请输入内容" type="password"></el-input>
      </el-form-item>

      <el-button type="primary" round @click="denglu">登录</el-button>
    </el-form>
  </div>
</template>

<style scoped lang="scss">
.login {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-image: url("../assets/images/login-background.jpg");
  background-size: cover;
}
.login-form {
  border-radius: 6px;
  background: #ffffff;
  width: 400px;
  padding: 25px 25px 5px 25px;
  .el-input {
    height: 38px;
    input {
      height: 38px;
    }
  }
  .input-icon {
    height: 39px;
    width: 14px;
    margin-left: 2px;
  }
}
</style>
